package com.example.tellwin.home.presenter;

import com.example.tellwin.api.TwjfApi;
import com.example.tellwin.base.RxPresenter;
import com.example.tellwin.base.SimpleCallback;
import com.example.tellwin.home.bean.ActivityDetailContentBean;
import com.example.tellwin.home.contract.ActivityDetailContract;
import com.example.tellwin.utils.HttpUtils;

import javax.inject.Inject;

import okhttp3.RequestBody;

/**
 * @author : LinZePeng
 * @date : 2020/11/26
 * @Describe ：
 **/
public class ActivityDetailPresenter extends RxPresenter<ActivityDetailContract.View> implements ActivityDetailContract.Presenter<ActivityDetailContract.View> {


    private TwjfApi mApi;

    private final int pageSize = 10;
    private int page;
    private int pageNum;

    boolean isBottom;

    @Inject
    public ActivityDetailPresenter(TwjfApi mApi) {
        this.mApi = mApi;
    }


    @Override
    public void activiteDetail(String actId) {
        mApi.getActivityDetail(actId , new SimpleCallback<ActivityDetailContentBean>(mView) {
            @Override
            public void onSuccess(ActivityDetailContentBean contentBean) {
                mView.activiteDetailResult(contentBean);
            }

            @Override
            public void onFail(String msg) {

            }
        });
    }

    @Override
    public void workVote(String participateId) {
        RequestBody requestBody = HttpUtils.getRequestBody("participateId" ,participateId);
        mApi.workVote(requestBody , new SimpleCallback<Object>(mView) {
            @Override
            public void onSuccess(Object o) {
                mView.workVoteSuccess();
            }

            @Override
            public void onFail(String msg) {

            }
        });
    }
}
